(function() {
	const response = {
		type: 'page',
		name: "opsMaintenance",
		title: '待报废资产申请',
		"toolbar": [
			{
				"type": "button",
				"label": "刷新",
				"onEvent": {
					"click": {
						"actions": [
							{
								"actionType": "refresh"
							}
						]
					}
				},
				"id": "u:921a0efbfa70"
			}
		],
		body:[
			{
				type: "crud",
				name: "amGetAssetRetirement",
				syncLocation: false,
				api: {
					method: "post",
					url: "/assetManager/amGetAssetRetirement"

				},
				"autoFillHeight": true,
				loadDataOnce: true,
				columns:[
					{
						name: "id",
						label: "申请编号",
						// hidden: true
					},
					{
						name: "assetId",
						label: "资产编号"
					},
					{
						name: "applicantId",
						label: "申请人编号"
					},
					{
						name: "status",
						label: "申请时资产状态"
					},
					{
						name: "result",
						label: "审批进度"
					},
					{
						name: "isComplete",
						label: "报废申请状态"
					},
					{
						name: "datetime",
						label: "申请时间"
					},
					{
						"type": "operation",
						"label": "操作",
						"width": 100,
						"buttons": [
							{
								"type": "button",
								"label": "同意申请",
								"actionType": "ajax",//同意申请
								"reload": "amGetAssetRetirement", //请求完成后刷新opGetAssetMaintenance组件
								"api": {
									"method": "post",
									"url": "/assetManager/amUpdateAssetRetirement",
									"data":{
										"approvalId": "${id}",
										"result": true
									},
									//当只剩最后一个记录的时候，再次发送审批请求后返回的status状态码为400，所以选择直接刷新
									adaptor: function (payload, response) {

										(function (){
											if(payload.status===400){
												window.location.reload();
											}
										})();
										return payload;
									}
								}
							},
							{
								"type": "button",
								"label": "拒绝申请",
								"actionType": "ajax",//拒绝申请
								"reload": "amGetAssetRetirement", //请求完成后刷新opGetAssetMaintenance组件
								"api": {
									"method": "post",
									"url": "/assetManager/amUpdateAssetRetirement",
									"data":{
										"approvalId": "${id}",
										"result": "false"
									},
									//当只剩最后一个记录的时候，再次发送审批请求后返回的status状态码为400，所以选择直接刷新
									adaptor: function (payload, response) {

										(function (){
											if(payload.status===400){
												window.location.reload();
											}
										})();
										return payload;
									}
								}
							}
						]
					}
				]


			}
		]

	}


	window.jsonpCallback && window.jsonpCallback(response);
})();
